package com.hospital.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hospital.entity.PrescriptionDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;

/**
 * 处方明细Mapper接口
 */
@Mapper
public interface PrescriptionDetailMapper extends BaseMapper<PrescriptionDetail> {
    
    @Select("SELECT pd.* FROM tb_prescription_detail pd " +
           "WHERE pd.prescription_id = #{prescriptionId} AND pd.deleted = 0")
    List<PrescriptionDetail> selectByPrescriptionId(Long prescriptionId);
    
    @Update("UPDATE tb_prescription_detail SET deleted = 1 " +
           "WHERE prescription_id = #{prescriptionId}")
    int deleteByPrescriptionId(Long prescriptionId);
} 